package org.nanfang.film;

import org.Thread.Threadyield;

public class Film extends Thread{
    /**
     * 电影票 - 50张
     */
    private int ticket = 50;

    public Film() {
    }

    public Film(String name) {
        super(name);
    }

    @Override
    public void run() {
        while (true) {
            if (ticket <= 0) {
                break;
            }

            String name = Thread.currentThread().getName();
            System.out.printf("%s 出售了第 %d 张电影票！%n", name, ticket);
            ticket--;
        }
    }
}
